//
//  TKMyOrderListCell.m
//  Ticket
//
//  Created by 小禹宝宝 on 2017/11/2.
//  Copyright © 2017年 cy55. All rights reserved.
//

#import "TKMyOrderListCell.h"
@interface TKMyOrderListCell ()
@property (weak, nonatomic) IBOutlet UIView *topShadowView;
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UILabel *orderStatusLabel;
@property (weak, nonatomic) IBOutlet UILabel *goodsNumberLabel;
@property (weak, nonatomic) IBOutlet UILabel *sellerNameLabel;
@property (weak, nonatomic) IBOutlet UIView *descBgView;
@property (weak, nonatomic) IBOutlet UIImageView *goodsPictureImageView;
@property (weak, nonatomic) IBOutlet UILabel *descriptionLabel;
@property (weak, nonatomic) IBOutlet UIImageView *sellerIconImageView;

@property (weak, nonatomic) IBOutlet UIButton *buyBtn;

@property (nonatomic, assign) TKOrderStatusType status;
@end
@implementation TKMyOrderListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.topShadowView.backgroundColor = [BLColorConfig backgroundColor];
    self.descBgView.backgroundColor = [BLColorConfig backgroundColor];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (IBAction)againBuyAction:(id)sender {
}

- (void)setModel:(TKOrderItem *)model {
    _model = model;
    self.priceLabel.text = [NSString stringWithFormat:@"合计：¥%@",model.price];
    self.status = model.status;
    switch (self.status) {
        case TKOrderStatusTypeToBePayment:
        {
            self.orderStatusLabel.text = @"待支付";

        }
            break;
        case TKOrderStatusTypePaymentCompleted:
        {
            self.orderStatusLabel.text = @"已支付";

        }
            break;
            
        default:
            break;
    }
    if ([model.number intValue] > 0) {
        self.goodsNumberLabel.text = [NSString stringWithFormat:@"共计%@件商品",model.number];
    } else {
        self.goodsNumberLabel.text = [NSString stringWithFormat:@"共计1件商品"];
    }
    
    self.sellerNameLabel.text = model.user.user_name;
    [self.goodsPictureImageView sd_setImageWithURL:[NSURL URLWithString:model.goods.headimg] placeholderImage:nil];
    self.descriptionLabel.text = model.goods.intro;
    [self.sellerIconImageView sd_setImageWithURL:[NSURL URLWithString:model.goods.headimg] placeholderImage:nil];

    
}
@end
